package framework;

/**
 * Presents the trait container of the framework
 *
 * @author	Orlin Tomov
 * @version	0.2
 *
 */
public interface Trait {

	/**
	 * Returns running status
	 *
	 * @return	running status of the server
	 */
	public boolean isRunning();

	/**
	 * Returns the class loader of the server. 
	 *
	 * @return	the class loader
	 */
	public ClassLoader getLoader();

	/**
	 * Pushes the message to the message queue
	 *
	 * @param	message	the message itself
	 * @param	sender	message sender
	 * @param	receiver	message recipient
	 */
	public void sendMessage(Message message, String sender, String receiver);

	/**
	 * Pushes the message to the message queue with dalay
	 *
	 * @param	message	the message itself
	 * @param	sender	message sender
	 * @param	receiver	message recipient
	 * @param 	timeout	delay (in ms)
	 */
	public void sendMessage(Message message, String sender, String receiver, int timeout);

	/**
	 * Pulls the next message from the queue for specific service by name
	 * 
	 * @param	serviceName	the service what message is looking for
	 * @return	message next message from the queue
	 */
	public <M extends Message> M pullMessage(String serviceName);

	/**
	 * @param	service
	 */
	public void addService(Service service);

	/**
	 * @param	service
	 */
	public void remove(Service service);

}
